<!doctype html>
<html>
{include file="./public/admin/common/head_css.html" /}
<style>
    *{padding:0px;margin:0px;}
    .pop {  display: none;  width: 500px; min-height: 100px;  max-height: 550px;  height:250px;  position: absolute;  top: 0;  left: 0;  bottom: 0;  right: 0;  margin: auto;  padding: 25px;  z-index: 130;  border-radius: 8px;  background-color: #fff;  box-shadow: 0 3px 18px rgba(100, 0, 0, .5);  }
    .pop-top{  height:40px;  width:100%;  border-bottom: 1px #E5E5E5 solid;  }
    .pop-top h2{  float: left;  display:block}
    .pop-top span{  float: right;  cursor: pointer;  font-weight: bold; display:block}
    .pop-foot{  height:440px;  line-height:40px;  width:100%;  border-top: 1px #E5E5E5 solid;  text-align: right;  }
    .pop-cancel, .pop-ok {  padding:8px 15px;  margin:15px 5px;  border: none;  border-radius: 5px;  background-color: #337AB7;  color: #fff;  cursor:pointer;  }
    .pop-cancel {  background-color: #FFF;  border:1px #CECECE solid;  color: #000;  }
    .pop-content-right{  width:310px; height: 50px;  float: left;  padding-top:20px;  padding-left:20px;  font-size: 16px;  line-height:35px;  }
    .pop-content-right select{  width:120px; height: 30px;  float: left;  padding-top:2px;  padding-left:20px;  font-size: 16px;  line-height:35px;  }
    .bgPop{  display: none;  position: absolute;  z-index: 129;  left: 0;  top: 0;  width: 100%;  height: 100%;  background: rgba(0,0,0,.2);  }
</style>
<body>
{include file="./public/admin/common/header.html" /}
<div class="container clearfix">
    {include file="./public/admin/common/left.html" /}
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="index.html">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">作品管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="#" method="post">
                    <table class="search-tab">
                        <tr>
                            <th width="120">选择分类:</th>
                            <td>
                                <select name="search-sort" id="access_level">
                                    <option value="0">一级权限</option>
                                    <option value="1">二级权限</option>
                                    <option value="2">三级权限</option>
                                </select>
                            </td>
                            <td id="yincang" style="display: none ;margin-top: 7px" >
                                <select name="search-sort" id="auth_id">
                                    <option value="">全部</option>
                                    {volist name="auth_infoA" id="v"}
                                    <option id="auth_infoA" value="{$v.auth_id}">{$v.auth_name}</option>
                                    {/volist}
                                </select>
                            </td>
                            <td id="yincang2" style="display: none ;margin-top: 7px" >
                                <select name="search-sort" id="auth_ids">
                                    <option value="">全部</option>
                                    {volist name="auth_infoB" id="V"}
                                    <option value="{$V.auth_id}">{$V.auth_name}</option>
                                    {/volist}
                                </select>
                            </td>

                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="keyword" id="keyword" type="text"></td>
                            <td><input class="btn btn-primary btn2" value="查询" id="search" type="submit" lay-submit="" lay-filter="search"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="javascript:void(0)" onclick="auth_add()"><i class="icon-font"></i>新增权限</a>
                        <a id="batchDel" href="javascript:void(0)" onclick="auth_dels()"><i class="icon-font"></i>批量删除</a>
                        <a id="outOrd" href="javascript:void(0)" onclick="all_status_compose(0)"><i class="icon-font"></i>批量导出</a>
                        <a id="inOrd" href="javascript:void(0)" onclick="all_status_compose(0)"><i class="icon-font"></i>批量导入</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" name="" id="allChk" type="checkbox"></th>
                            <th >权限名</th>
                            <th >控制器</th>
                            <th >方法名</th>
                            <th >级别</th>
                            <th >操作</th>
                        </tr>
                        <tbody id="auth_list">
                        </tbody>

                    </table>
                    <div id="pages"></div>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
</div>
</body>

<!--遮罩层,修改角色信息-->
<div class="bgPop"></div>
<!--弹出框-->
<div class="pop">
    <div class="pop-top">
        <h2>更改权限</h2>
        <span class="pop-close" onclick="auth_outcli()">Ｘ</span>
    </div>
    <div class="pop-content-right">
        <table>
            <tr>
                <td><i class="require-red">*</i>权限名称：</td>
                <td>
                    <input class="common-text required" id="auth_name" name="auth_name" size="20" value="" type="text">
                    <input id="a_id"  value="" type="hidden">
                </td>
            </tr>
            <tr>
                <td width="120"><i class="require-red">*</i>选择级别:</td>
                <td>
                    <select name="search-sort" id="auth_level">
                        <option value="one">一级</option>
                        <option value="">二级</option>
                    </select>
                    <select name="search-sort" id="auth_pid" style="display: none">
                        {volist name="auth_infoA" id="v"}
                        <option value="{$v.auth_id}">{$v.auth_name}</option>
                        {/volist}
                    </select>
                </td>
            </tr>
            <tr id="c" style="display: none">
                <td><i class="require-red">*</i>控制器：</td>
                <td>
                    <input class="common-text required" id="auth_c" name="title" size="20" value="" type="text">
                </td>
            </tr>
            <tr id="a" style="display: none">
                <td><i class="require-red">*</i>方法名：</td>
                <td>
                    <input class="common-text required" id="auth_a" name="title" size="20" value="" type="text">
                </td>
            </tr>
        </table>
    </div>
    <div class="pop-foot">
        <input type="button" value="取消" onclick="auth_outcli()" class="pop-cancel pop-close">
        <input type="button" value="确定" onclick="auth_update()" class="pop-ok">
    </div>
</div>

{include file="./public/admin/common/JS.html" /}
<script src="__static__/js/user/authList.js"></script>
<script>
    var auth_id = '';
    var auth_level = $('#access_level').val();
    var keyword = '';
    getAuthListPage(url_list.auth_list,keyword,auth_id,auth_level);

    $(function () {
        //搜索
        $('#search').click(function () {
            var auth_id = $('#auth_id').val();
            var keyword =$('#keyword').val();
            var auth_level = $('#access_level').val();
            getAuthListPage(url_list.auth_list,keyword,auth_id,auth_level);
            return false;
        });
        //二级权限
        $('#auth_id').change(function () {
            var auth_id = $('#auth_id').val();
            var keyword =$('#keyword').val();
            var auth_level = $('#access_level').val();
            getAuthListPage(url_list.auth_list,keyword,auth_id,auth_level);
            return false;
        });
        //三级权限
        $('#auth_ids').change(function () {
            var auth_id = $('#auth_ids').val();
            var keyword =$('#keyword').val();
            var auth_level = $('#access_level').val();
            getAuthListPage(url_list.auth_list,keyword,auth_id,auth_level);
            return false;
        });
        //一级权限
        $('#access_level').change(function () {
            var auth_id = '';
            var keyword =$('#keyword').val();
            var auth_level = $('#access_level').val();

            if(auth_level==0) {
                document.getElementById("yincang").style.display="none";
                document.getElementById("yincang2").style.display="none";
                document.getElementById("auth_id").style.display='';
                document.getElementById("auth_ids").style.display='';

            }
            else if (auth_level==1){
                document.getElementById("yincang").style.display="block";
                document.getElementById("yincang2").style.display="none";
            }else if (auth_level==2){
                document.getElementById("yincang2").style.display="block";
                document.getElementById("yincang").style.display="none";
            }
            getAuthListPage(url_list.auth_list,keyword,auth_id,auth_level);
            return false;

        });
        //弹窗的隐藏选项
        $('#auth_level').change(function () {
            if($('#auth_level').val() == "one") {
                $("#a").hide();
                $("#c").hide();
                $("#auth_pid").hide();
                document.getElementById("auth_pid").value='';
            }
            else{
                $("#a").toggle();
                $("#c").toggle();
                $("#auth_pid").toggle();
                document.getElementById("auth_pid").value=1;
            }
        })
    })


</script>
</html>